﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Swimj.Core.Providers;
using Swimj.Core.Securities;

namespace BaseData.InfrastructureLib;

public class BaseDataDesignFactory : IDesignTimeDbContextFactory<BaseDataDbContext>
{
    public BaseDataDbContext CreateDbContext(string[] args)
    {
        var dbContextOptionsBuilder = new DbContextOptionsBuilder<BaseDataDbContext>()
            .UseSqlServer(
                "Server=127.0.0.1,5433;Initial Catalog=youAdminDB;User Id=sa;Password=Pass@word;Encrypt=false");
        return new BaseDataDbContext(dbContextOptionsBuilder.Options, null!,
            new CurrentUser(), new LocalDataTimeProvider());
    }
}